package com.xiaomi.method;
import com.xiaomi.pojo.Employee;
import com.xiaomi.pojo.EmployeeMessage;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        List<Employee> list = new ArrayList<>();
        //初始化数据
        Employee e1 = new Employee(1, "张三", 30,"12345678901",
                "123456789012345671","北京", "男", "软件工程师", 15000.00, EmployeeMessage.ON_THE_JOB,LocalDateTime.now(),LocalDateTime.now());
        Employee e2 = new Employee(2, "李四", 28,"12345678902",
                "123456789012345672","上海", "女", "软件工程师", 18000.00,EmployeeMessage.ON_THE_JOB,LocalDateTime.now(),LocalDateTime.now());
        Employee e3 = new Employee(3, "王五", 25,"12345678903",
                "123456789012345673","广州", "男", "软件工程师", 20000.00,EmployeeMessage.ON_THE_JOB,LocalDateTime.now(),LocalDateTime.now());
        list.add(e1);
        list.add(e2);
        list.add(e3);

        while (true){
            System.out.println(EmployeeMessage.YGGL);
            System.out.println(EmployeeMessage.CHOOSE);
            Scanner scanner = new Scanner(System.in);
            int i = scanner.nextInt();
            if (i == 6){
                break;
            }else if(i == 1){
                EmployeeSystem.add(list);
            }else if(i==2){
                EmployeeSystem.delete(list);
            }else if(i == 3){
                System.out.println(EmployeeMessage.UPDATA_JOB);
                System.out.println(EmployeeMessage.UPDATA_SALARY);
                System.out.println(EmployeeMessage.UPDATA_INFORMATION);
                String j = scanner.next();
                if (EmployeeMessage.CHOOSE_A.equals(j)){
                    EmployeeSystem.updateJob(list);
                }else if (EmployeeMessage.CHOOSE_B.equals(j)){
                    EmployeeSystem.updateSalary(list);
                }else if (EmployeeMessage.CHOOSE_C.equals(j)){
                    EmployeeSystem.updateInformation(list);//TODO 完善员工个人信息修改
                }
                else {
                    System.out.println(EmployeeMessage.INPUT_VOID);
                }
            } else if(i == 4){
                System.out.println(EmployeeMessage.SHOW_EMPLOYEE);
                System.out.println(EmployeeMessage.SELCET_EMPLOYEE);
                String j = scanner.next();
                if (EmployeeMessage.CHOOSE_A.equals(j)){
                    EmployeeSystem.view(list);
                }else if (EmployeeMessage.CHOOSE_B.equals(j)){
                    EmployeeSystem.viewOne(list);
                }else {
                    System.out.println(EmployeeMessage.INPUT_VOID);
                }
            }else if(i == 5){
                System.out.println(EmployeeMessage.EMPLOYEE_STATUS);
                System.out.println(EmployeeMessage.EMPLOYEE_STATUS_UPDATA);
                String j = scanner.next();
                if (EmployeeMessage.CHOOSE_A.equals(j)){
                    System.out.println(EmployeeMessage.SHOW_EMPLOYEE);
                    System.out.println(EmployeeMessage.SELCET_EMPLOYEE);
                    String k = scanner.next();
                    if(EmployeeMessage.CHOOSE_A.equals(k)){
                        EmployeeSystem.viewStatus(list);
                    }else if(EmployeeMessage.CHOOSE_B.equals(k)){
                        EmployeeSystem.selectStatus(list);
                    }
                }else if (EmployeeMessage.CHOOSE_B.equals(j)){
                    EmployeeSystem.updateStatus(list);
                }else {
                    System.out.println(EmployeeMessage.INPUT_VOID);
                }
            }else {
                System.out.println(EmployeeMessage.INPUT_VOID);
            }
        }
    }
}